package com.chap17.completablefuture;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

/**
 * <p>
 * <code>Demo01</code>
 * </p>
 *
 * @author junbao3
 * TODO
 * @date 2023-05-08 15:05
 * Copyright (C) 2021 IFlyTek. All rights reserved.
 */
public class Demo01 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Runnable runnable = ()-> System.out.println("执行无返回结果的异步任务");
        CompletableFuture.runAsync(runnable);

        //不加这句，可能看不到效果，多运行几次偶尔会看到打印语句
        //因为还没等runnable异步执行，主线程就结束了
//        Thread.sleep(5000);

    }
}
